import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App';

//引入仓库
import store from "./store/store"
//react-router-dom提供了一个路由器组件BrowserRouter
import { BrowserRouter } from 'react-router-dom';

//把所有的组件放在路由器中
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
  <BrowserRouter>
    <App />
  </BrowserRouter>
);

//状态更新了需要重新渲染,store上的subscribe方法
store.subscribe(()=>{
  root.render(
    <BrowserRouter>
      <App />
    </BrowserRouter>
  );
})


